package com.yuven.appframework.network;

import com.yuven.appframework.config.AppFrameWorkConstant;
import com.yuven.appframework.network.interceptor.HeaderInterceptor;
import com.yuven.appframework.network.interceptor.TimeCalibrationInterceptor;
import com.yuven.baselib.network.RetrofitClientProvider;

import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;

/**
 * Created by lzz on 2018/5/16.
 */
public abstract class CommonRetrofitManager extends RetrofitClientProvider {

    @Override
    protected String getBaseUrl() {
        return AppFrameWorkConstant.BASE_URL;
    }

    @Override
    protected void addInterceptor(OkHttpClient.Builder builder) {
        super.addInterceptor(builder);
        builder.addInterceptor(new HeaderInterceptor());
        builder.addInterceptor(new TimeCalibrationInterceptor());
        HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(new OkHttpXLog());
        httpLoggingInterceptor.level(HttpLoggingInterceptor.Level.BODY);
        builder.addInterceptor(httpLoggingInterceptor);
    }

}
